<%@ Page Title="" Language="C#" MasterPageFile="~/Themes/Default/Popup.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="MvcContrib.UI.Html" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	<% =Html.Resource("Warehouse", "TITLE_PARENTWAREHOUSE")%>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h3><% =Html.Resource("Warehouse", "TITLE_PARENTWAREHOUSE")%></h3>
    <form id="popup_query_form" name="popup_query_form" method="post" action="">
    <%=Html.Hidden("request_data")%>
    <div class="tree-themeroller ui-widget-content" id="treeview" style="width:218px; height:320px; ">
    <ul>
        <%Html.RenderPartial("WarehouseItemControl", ViewData.Model,ViewData);%>
    </ul>
    </div>
    </form>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
        <%=Html.Stylesheet("~/Content/jstree/themes/themeroller/style.css")%>
        <%=Html.ScriptInclude("~/Scripts/jquery.hotkeys.js")%>
    <%=Html.ScriptInclude("~/Scripts/sarissa.js") %>
    <%=Html.ScriptInclude("~/Content/jstree/jquery.tree.min.js") %>
    <%=Html.ScriptInclude("~/Content/jstree/plugins/jquery.tree.hotkeys.js")%>
    <%=Html.ScriptInclude("~/Content/jstree/plugins/jquery.tree.themeroller.js")%>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="PostScript" runat="server">
    <script type="text/javascript" language="javascript">
        /* initialize the popup request from the parent */

        if (window.document.forms['popup_query_form'].request_data.value == "") {
            window.document.forms['popup_query_form'].request_data.value =
                JSON.stringify(window.opener.get_popup_request_data());
        }


        $(document).ready(function() {
            jQuery("#treeview").tree({
                types: {
                    "default": { draggable: false }
                },
                plugins: {
                    hotkeys: {}
                },
                ui: { theme_name: "classic" },
                callback: {
                    ondblclk: function(node, treeObj) {
                        var data={"name":$(node).children().eq(0).text(),"id":$(node).attr("warehouseid")};
                        //$(node).attr("warehouseid")
                        return sendback(data);
                    }
                }
            });
            //expand all tree nodes
            jQuery.tree.focused().open_all(); 
        });
    </script>
</asp:Content>
